import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
import TreeTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css' // import styles
import 'quill/dist/quill.snow.css' // for snow theme
import 'quill/dist/quill.bubble.css' // for bubble theme
import nprogress from 'nprogress'
import 'nprogress/nprogress.css'

axios.defaults.baseURL='/api'
Vue.prototype.$http=axios
axios.interceptors.request.use(config=>{
	config.headers.Authorization=window.sessionStorage.getItem('token')
	nprogress.start()
	return config 
})
axios.interceptors.response.use(config=>{
	nprogress.done()
	return config
})

Vue.component('tree-table', TreeTable)
Vue.config.productionTip = false

Vue.use(VueQuillEditor)
Vue.filter('dataFormat',function(originVal){
	const st=new Date(originVal*1000)
	const y=st.getFullYear()
	const m=(st.getMonth()+1+'').padStart(2,'0')
	const d=(st.getDay()+'').padStart(2,'0')
	
	const hh=(st.getHours()+'').padStart(2,'0')
	const mm=(st.getMinutes()+'').padStart(2,'0')
	const ss=(st.getSeconds()+'').padStart(2,'0')
	return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
